<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/homepage' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>全部商品</el-breadcrumb-item>
      <el-breadcrumb-item>分类</el-breadcrumb-item>
      <el-breadcrumb-item></el-breadcrumb-item>
    </el-breadcrumb>
    <div class="List-top">
      <div class="title">分类</div>
      <el-tabs
        v-model="activeName"
        type="card"
        style="width: 1500px;line-height: 30px;font-size: 16px; margin-left: 96px;"
      >
        <el-tab-pane
        @change=""
          @tab-click="handleClick(item.product_id)"
          v-for="item in BiaoList"
          :key="item.category_id"
          :label="item.category_name"
        ></el-tab-pane>
      </el-tabs>
    </div>
    <my-list :listData="all"></my-list>
  </div>
</template>
<script>
import API from "../api/shopp";
export default {
  data() {
    return {
      activeName: "",
      BiaoList: [],
      all: []
    };
  },
  created() {
    this.List();
    this.AllProduct();
  },
  methods: {
    async List() {
      let res = await API.shoppList();
      this.BiaoList = res.category;
      this.BiaoList.unshift({
        category_id: 0,
        category_name: "全部"
      });
    },
    async AllProduct() {
      let res = await API.AllShoppList();
      this.all = res.Product;
      console.log(this.all);
    },
    handleClick(id) {
        console.log(id);
    }
  }
};
</script>
<style lang="scss" scoped>
.el-breadcrumb {
  //   width: 1500px;
  line-height: 30px;
  font-size: 16px;
  margin-left: 96px;
}
.title {
  // padding: 0 20px;
  // height: 40px;
  // box-sizing: border-box;
  // line-height: 40px;
  // display: inline-block;
  // list-style: none;
  font-size: 20px;
  font-weight: 500;
  color: #303133;
  position: relative;
  top: 10px;
  left: 92px;
}
.List-top {
  display: flex;
}
</style>
